/*
**This header file will contain all the data structures and decleration needed **for the project 
*/


#include <stdio.h>
#include <malloc.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>



typedef struct vertex vertex;
typedef struct graph graph;
typedef struct list list;
typedef struct Node Node;
typedef struct LinkedList LinkedList;
typedef struct Set Set;
typedef struct vertexSet vertexSet;
typedef struct decompositionSet decompositionSet;




typedef enum {FALSE=0, TRUE = 1} Boolean;

struct Node
{
	int data;
	vertex *vert;
	Node *link ;
} ;

struct LinkedList
{
	Node *head ;
} ;

struct Set
{
	vertex *v;
	int key1,key2;
};



struct vertexSet{
	Set *s;
	vertexSet *low;
	vertexSet *high;
};



struct vertex
{
	vertex *low;
	vertex *high;
	char *c;
	int index;
	int value;
	int id;
	Boolean mark;
};

struct list
{
	vertex *u;
	int index;
};

struct decompositionSet
{
        char *variable;
        char *argv;
        vertex *ver;
};

struct graph
{
	vertex *root;
	decompositionSet *dSet[20];
	char *variables[1000];
	int totVar;
};



//////////// Function used in graph.c


void init(graph *g); 

int size(struct vertex* vertex,int i, int var);

int graphSize(graph *g, int var);

struct vertex *insertVertex(int val, int index, char * c, int id );

////////////////Function used in reduction.c

void reduction(graph *g, int var);


//////////////Function used in apply.c


graph *applyFunc(graph *g,graph *g1, graph *g2, int var1, int var2, char op);


//////////////////Function used in parse.c

void parse(char *a, char **variables, graph *g);

void initVariables(char *c,char **variables, graph *g);

int checkIndex(char *c, char **variables, graph *g);


////////////////////////Function used in build.c

int condition(char *,char *, char *, char);

void showIndex(graph *);

void changeIndex(graph *);

char *refine(char *);

char *expression(char *, char *);

vertex *buildStep(char *, int ,graph *);

void build(graph *,char * );

//////////////////////Function in buildPartial.c
